package com.fcat.common.ftp;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;


@Mojo(name = "sftpMojo", defaultPhase = LifecyclePhase.INSTALL)
public class PrintMojo extends AbstractMojo {

    @Parameter(property = "ip")
    private String ip;
    @Parameter(property = "port")
    private String port;
    @Parameter(property = "username")
    private String username;
    @Parameter(property = "password")
    private String password;
    @Parameter(property = "projectPath")
    private String projectPath;
    @Parameter(property = "module")
    private String module;
    @Parameter(property = "packageType")
    private String packageType;

    @Override
    public void execute() {
        if (!"jar".equals(packageType)) return;
        Sftp sftp = new Sftp(ip, port, username, password, projectPath);
        sftp.uploadJarFile(module);
    }
}
